
var options = { 
        beforeSubmit:  showRequest,
        success:       showResponse ,
        url: $('#cornAddForm').attr("action")
}; 
$('#cornAddForm').ajaxForm(options);

function showRequest(formData, jqForm, options) { 
	var file = $("#corn_add_file").val();
	if(file==null||file==''){
		alert("请选择样品execl文件");
		return;
	}else{
		var ext = file.slice(file.lastIndexOf(".")+1).toLowerCase();
		if ("xls" != ext && "xlsx" != ext) {  
	        alert("只能上传Excle文件");  
	        return;  
		}  
	}	
    var queryString = $.param(formData); 
    return true; 
} 
		 
function showResponse(responseText, statusText)  { 
	try{
		var v = eval(responseText);
		if(v[0] && v[0].error){
			alert(v[0].error);
		}
	}catch(e){
		addTab("tab_a","allshow",$("#basePath").val()+"/test/allshow.form","种子库信息展现",false,true);
	}
} 